package com.onefinger.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.onefinger.domain.CustomerTable;

@Transactional
public class CustomerTableController implements ICustomerTableController {

	@Autowired
	ICustomerTableService customerTableService;
	
	@Override
	public List<CustomerTable> list() {
		return customerTableService.list();
	}

	@Override
	@Transactional
	public CustomerTable assignDevice( Long customerTableId,  Long deviceId ) {
		return customerTableService.assignDevice( customerTableId,  deviceId );
	}

	@Override
	public CustomerTable open(Long customerTableId) {
		return customerTableService.changeStatus( customerTableId, CustomerTable.STATUS_OPEN );
	}

	@Override
	public CustomerTable close(Long customerTableId) {
		return customerTableService.changeStatus( customerTableId, CustomerTable.STATUS_CLOSE );
	}

	@Override
	public CustomerTable getCustomerTableByDevice(String deviceId) {
		return customerTableService.getCustomerTableByDevice( deviceId );
	}
	
}
